class HyperlinksController < ApplicationController
  # GET /hyperlinks
  # GET /hyperlinks.xml
  def index
    @hyperlinks = Hyperlink.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @hyperlinks }
    end
  end

  # GET /hyperlinks/1
  # GET /hyperlinks/1.xml
  def show
    @hyperlink = Hyperlink.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @hyperlink }
    end
  end

  # GET /hyperlinks/new
  # GET /hyperlinks/new.xml
  def new
    @hyperlink = Hyperlink.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @hyperlink }
    end
  end

  # GET /hyperlinks/1/edit
  def edit
    @hyperlink = Hyperlink.find(params[:id])
  end

  # POST /hyperlinks
  # POST /hyperlinks.xml
  def create
    @hyperlink = Hyperlink.new(params[:hyperlink])

    respond_to do |format|
      if @hyperlink.save
        format.html { redirect_to(@hyperlink, :notice => 'Hyperlink was successfully created.') }
        format.xml  { render :xml => @hyperlink, :status => :created, :location => @hyperlink }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @hyperlink.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /hyperlinks/1
  # PUT /hyperlinks/1.xml
  def update
    @hyperlink = Hyperlink.find(params[:id])

    respond_to do |format|
      if @hyperlink.update_attributes(params[:hyperlink])
        format.html { redirect_to(@hyperlink, :notice => 'Hyperlink was successfully updated.') }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @hyperlink.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /hyperlinks/1
  # DELETE /hyperlinks/1.xml
  def destroy
    @hyperlink = Hyperlink.find(params[:id])
    @hyperlink.destroy

    respond_to do |format|
      format.html { redirect_to(hyperlinks_url) }
      format.xml  { head :ok }
    end
  end
end
